<!DOCTYPE html>
<html lang="zh-CN"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>房屋租赁登记备案信息查询</title>
<link rel="stylesheet" type="text/css" href="style/authority/jquery-ui-1.10.4.custom.css">
<link rel="stylesheet" type="text/css" href="style/authority/common.css">
<link rel="stylesheet" type="text/css" href="style/authority/style.css">
</head>
<body style="">
<div class="top-logo">
    <div class="logo" no-repeat center>
        <span class="left">房屋租赁登记备案信息查询</span>
        <!--<span class="right">-->
            <!--<a href="https://zw.cdfgj.gov.cn/rentcollection/publicQuery/index" class="">首页</a>-->
        <!--</span>-->
    </div>
</div>
<div class="nav nav-nobg" id="searchForm">
    <form id="recordQueryForm" >
        <input id="key" name="key" type="hidden">
        <table class="nav-table input-table" width="100%" cellspacing="0" cellpadding="0">
            <tbody>
            <tr>
                <th width="30%">备案编号</th>
                <td>
                    <input type="text" id="recordNo" name="recordNo" class="required" value="">
                </td>
            </tr>
            <tr>
                <th>承租方姓名</th>
                <td>
                    <input type="text" id="lesseeName" name="lesseeName" class="required">
                </td>
            </tr>
            <tr>
                <th>手机号</th>
                <td>
                    <input type="text" id="phone" name="phone" class="required">
                </td>
            </tr>
            <tr id="ownerShipNoTr">
                <th>验证码</th>
                <td>
                    <input id="code" name="code" type="text" class="required">
                    <input id="getCode" type="button" class="button-blue short" value="获取验证码" onclick="getQueryVerificationCode()">
                </td>
            </tr>
            </tbody>
        </table>
        <input type="button" class="button-blue middle" value="查询" onclick="recordQuery()">
    </form>
    

</div>
<div class="dialog-box" style="display: none">
    <div id="dialog-msg" title="提示" class="write-content">
        <h1></h1>
    </div>
</div>

<div class="nav nav-nobg" id="resultInfo" style="margin-top: -50px; display: none; ">
    <table class="nav-table input-table" id="moban" width="100%" cellspacing="0" cellpadding="0" >
        <tbody>
            <tr>
                <th width="30%">房屋地址</th>
                <td type="text" id="address" name="address" class="required">
                </td>
            </tr>
            <tr>
                <th width="30%">租赁用途</th>
                <td type="text" id="yt" name="yt" class="required">
                </td>
            </tr>
            <tr>
                <th width="30%">出租方</th>
                <td type="text" id="czf" name="czf" class="required">
                </td>
            </tr>
            <tr>
                <th width="30%">承租方</th>
                <td type="text" id="zpf" name="zpf" class="required">
                </td>
            </tr>
            <tr>
                <th width="30%">承租类型</th>
                <td type="text" id="zpflx" name="zpflx" class="required">
                </td>
            </tr>
            <tr>
                <th width="30%">备案有效开始时间</th>
                <td type="text" id="starttime" name="starttime" class="required">
                </td>
            </tr>
            <tr>
                <th width="30%">备案有效结束时间</th>
                <td type="text" id="endtime" name="endtime" class="required">
                </td>
            </tr>
        </tbody>
    </table>
</div>



<script type="text/javascript" src="style/authority/jquery-1.10.2.min.js.下载"></script>
<script type="text/javascript" src="style/authority/jquery-ui-1.10.4.custom.min.js.下载"></script>
<script type="text/javascript" src="style/authority/validate.js.下载"></script>
<script type="text/javascript" src="style/authority/messages_cn.js.下载"></script>
<script>
    $(function () {
        $("#recordNo").val("");
        $("#lesseeName").val("");
        $("#phone").val("");
        $("#code").val("");
    });
    Date.prototype.format = function (fmt) { //author: meizz
        var o = {
            "M+": this.getMonth() + 1, //月份
            "d+": this.getDate(), //日
            "H+": this.getHours(), //小时
            "m+": this.getMinutes(), //分
            "s+": this.getSeconds(), //秒
            "q+": Math.floor((this.getMonth() + 3) / 3), //季度
            "S": this.getMilliseconds() //毫秒
        };
        if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
        for (var k in o)
            if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
        return fmt;
    }

    function showMessage(message,height,width) {
        $("#dialog-msg").children().remove();
        $("#dialog-msg").append('<h1>'+message+'</h1>');
        $("#dialog-msg").dialog({
            height: height,
            width: width,
            modal: true,
            buttons: {
                "关闭": function () {
                    $(this).dialog("close");
                }
            }
        });
    };


    function getQueryVerificationCode() {
        $("#key,#code").val("");
        var phone = $("#phone").val();

        if("" == phone || !phone){
            showMessage("请输入电话号码",200,400);
            return;
        }
        //$("#_bt_phone").attr("disabled", "disabled");
        setTime($("#getCode"),$("#phone"), 120);

        $.ajax({
            type: "get",
            url: '/info/getSMSCode/' + phone,
            dataType: "json",
            success: function (data) {
                if (data.success) {
                    showMessage("验证码已发送请注意查收",200,400);
                    $("#key").val(data.result.key);
                }
            }
        });
    }

    function setTime(val,codeValue, countdown) {
        //$("#_bt_phone").attr("disabled", "disabled");
        if (countdown == 0) {
            val.removeAttr("disabled");
            codeValue.removeAttr("readonly");
            val.val("获取验证码");
            return false;
        } else {
            val.attr("disabled", "disabled");
            codeValue.attr("readonly", "readonly");
            val.val(countdown + "秒后再次获取");
            countdown--;
        }
        setTimeout(function () {
            setTime(val,codeValue, countdown)
        }, 1000);
    }

</script>
<script>
    function recordQuery(){
        if($("#recordQueryForm").valid()) {
            // $("#recordQueryForm").submit();
        }
        var phone = $("#phone").val();
        var code = $("#code").val();
        var recordNo = $("#recordNo").val();
        var lesseeName = $("#lesseeName").val();

        $.get("/info/findInfo/"+phone+"/"+code+"?bano="+recordNo+"&zcf="+lesseeName,function(data){
            if(data.success==false){
                if(data.message=="1001"){
                    showMessage("未查到相关信息,请检查",200,400);
                }else{
                    showMessage(data.message,200,400);
                }
            }
            if(data.success==true){
                document.getElementById("resultInfo").style.display="";
                if(data.message != null){
                    $("#recordNo").val("");
                    $("#lesseeName").val("");
                    $("#phone").val("");
                    $("#code").val("");
                    document.getElementById("address").innerText = data.message.address;
                    document.getElementById("yt").innerText = data.message.yt;
                    document.getElementById("zpf").innerText = data.message.zpf;
                    document.getElementById("czf").innerText = data.message.czf;
                    document.getElementById("zpflx").innerText = data.message.zpflx;
                    document.getElementById("starttime").innerText = getMyDate(data.message.starttime);
                    document.getElementById("endtime").innerText = getMyDate(data.message.endtime);
                }else{
                    document.getElementById("address").innerText = "";
                    document.getElementById("yt").innerText = "";
                    document.getElementById("zpf").innerText = "";
                    document.getElementById("zpflx").innerText = "";
                    document.getElementById("starttime").innerText = "";
                    document.getElementById("endtime").innerText = "";
                    showMessage("无查询结果",200,400);
                }
            }
        });
    };

    function getMyDate(str){
        var oDate = new Date(str),
            oYear = oDate.getFullYear(),
            oMonth = oDate.getMonth()+1,
            oDay = oDate.getDate(),
            oTime = oYear +'-'+ getzf(oMonth) +'-'+ getzf(oDay);//最后拼接时间
        return oTime;
    };
    //补0操作
    function getzf(num){
        if(parseInt(num) < 10){
            num = '0'+num;
        }
        return num;
    }
</script>

</body></html>